package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.Daouser;
import Dao.impl.Daoimpluser;
import entity.User;
@WebServlet(name="zhuche",urlPatterns="/zhuche.do")
public class zhuche extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String sjh = request.getParameter("sjh");
		String mima = request.getParameter("password");
		User user = new User();
		user.setName(sjh);
		user.setPassword(mima);
		Daouser dao = new Daoimpluser();
		boolean jia = dao.add(sjh, mima);
		if(jia){
			request.getRequestDispatcher("denglu.jsp").forward(request, response);
		}else{
			
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
